#include "Interpolation.h"
#include <iostream>

using namespace std;

double f(double input)
{
  return 1 / (1 + input*input);
};

int main()
{
  freopen("./data/B.txt","w",stdout); 
  for (double n = 2; n <= 8; n += 2)
    {
      vector<double> x,y;
      for (double i = 0; i <= n; i++)
	{
	  x.push_back(-5.0+10.0*i/n);
	  y.push_back(f(-5.0+10.0*i/n));
	}
      Newton_formula Newton(x,y);
      for (double i = -5; i <= 5; i += 0.01)
	{
	  printf("%lf,",Newton.operate(i));
	}
      puts("");
    }
  for (double i = -5; i <= 5; i += 0.01)
    {
      printf("%lf,",f(i));
    }
  fclose(stdout);
  return 0;
}
